#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int a = 0, b = 0;
	while (scanf("%d %d", &a, &b) != EOF) {
		while (a && b) {
			a > b ? (a = a % b):(b = b % a);
		}
		a == 0 ? printf("%d", b) : printf("%d", a);
	}
	return 0;
}